<%= javascript_include_tag 'dragdrop' %>

<%@title = "私人文件夹"%>
<script>
			function select_all(form)
			{
				if (form.selectall.checked)
				{
					for(var i=0; i<form.elements.length-1; i++)
					{
						form.elements[i].checked = true;
					}
					
				}
				else
				{
					for(var i=0; i<form.elements.length-1; i++)
					{
						form.elements[i].checked = false;
					}
				}
			}
</script>
		
<%= start_form_tag({:action => 'upload_file'}, :multipart => true) %>   

<div id=float_news style=" position:		absolute;
			 	 	    left:       100px;
			 	 	    top:        70px;
			 	 	    width:		400px;
					    background-color:	#CCCCCC;
					    display:		none;
					    overflow:		hidden; 
					    z-index:2;         
					    ">				    
    
        <table width="100%" cellpadding="0" cellspacing="0" bordercolor="#999999">
            <tr id="handle" class="clsTrHeader1" width=100%>
            <td align=center width=90% id='forumlist'>所有用户</td>
            <td align=right width=10%><%=link_to_function "关闭", "Effect.BlindUp('float_news') "%></td>
            </tr>
        </table>
        <br> 
      <div style="overflow:		auto;
						  height:		387px;
						  SCROLLBAR-FACE-COLOR: #CCCCCC; 
						  SCROLLBAR-HIGHLIGHT-COLOR: #AAAAAA;
						  SCROLLBAR-SHADOW-COLOR: #AAAAAA; 
						  SCROLLBAR-3DLIGHT-COLOR: #AAAAAA; 
						  SCROLLBAR-ARROW-COLOR: #AAAAAA; 
						  SCROLLBAR-TRACK-COLOR: #AAAAAA;
						  SCROLLBAR-DARKSHADOW-COLOR: #AAAAAA;">
        
        <table width="100%" cellspacing=0 cellpadding=0 border=0 >      
        <tr><td colspan=2><input type="checkbox" name='selectall'onclick="select_all(form)"/>全选</td></tr>    
        <tr class='clsTrHeader'>
            <th width=60%>姓名</th>
            <th width=40%>选择</th>
        </tr>
        
        <%index = 0%>
        
        <% for user in @users%>  
            <%=ColorRow(index)%>
                <td>&nbsp;&nbsp;<%=user.truename||'（无）'%></td>
                <td align="center"><input type="checkbox" name="user[]" value="<%=user.id%>" </td>
            </tr>
            <%index+=1%>
        <% end%>        
    </table>
    </div>
</div>
<%= draggable_element("float_news", :handle => 'handle')%>

<table width="70%" align="center" style="BORDER-COLLAPSE: collapse" id='topnode' style="display:none"> 
<script>
   Effect.Appear('topnode');
</script>           
  <tr>
    <td colspan='7'>  
           
             <%=link_to_function "选择目标用户", "Effect.BlindDown('float_news')"%><br>
              <!--
              <%=select("sharefile", "userid", YtaplUser.find(:all).collect{|u| [u.truename, u.id]})%> 
              -->	
              	文件名称: <%= text_field "sharefile", 'name'%> <br>
                选择文件：<%= file_column_field 'sharefile', 'path' %>
                <input type="submit" value="发  送" />
           
     </td>
  </tr>
  <tr class='clsTrHeader'>
           <td>文件名称</td>
           <td align="center">发送人</td>
           <td align="center">发送时间</td>
           <td colspan = 2 align="center">操作</td>
  </tr>
  <%index=0%>
  <% for file in @files%>
     <%= ColorRow(index)%>
         <td width="30%"><%= file.name%></td>
         <td width="20%"><%= file.sender%></td>
         <td width="20%"><%= file.uploadtime.strftime("%Y-%m-%d")%></td>
         <td><%= link_to '下载', {:action=>'download_file', :id=>file}, {:style=> "color: darkblue;"}%></td>
         <td><%= link_to '删除', {:action=>'delete_file', :id=>file}, :confirm=>'确定删除当前文件吗？'%></td>
     </tr>  
     <% index += 1%>
  <% end%>
</table>
<br>
<%= end_form_tag %>